package com.atguigu.crowd.funding.service.impl;

import com.atguigu.crowd.funding.entity.Meun;
import com.atguigu.crowd.funding.entity.MeunExample;
import com.atguigu.crowd.funding.mapper.MeunMapper;
import com.atguigu.crowd.funding.service.api.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hftang
 * @date 2019-10-30 10:10
 * @desc
 */
@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MeunMapper meunMapper;


    @Override
    public List<Meun> getAll() {
        return this.meunMapper.selectByExample(new MeunExample());
    }

    @Override
    public void saveMenu(Meun menu) {
        meunMapper.insert(menu);
    }

    @Override
    public Meun getMenuById(Integer menuId) {
        return meunMapper.selectByPrimaryKey(menuId);
    }

    @Override
    public void updateMenu(Meun menu) {
        meunMapper.updateByPrimaryKeySelective(menu);
    }
}
